{% set master = salt["pillar.get"]("rabbitmq:master") %}
{% set curr_ips = salt["network.ip_addrs"]() %}
Setting rabbitmq:
  cmd.run:
    - name: |
        {% if master["ip"] in curr_ips %}
        rabbitmqctl add_user jsapi 123456
        rabbitmqctl set_user_tags jsapi administrator
        rabbitmqctl add_vhost applications
        rabbitmqctl set_permissions -p applications jsapi ".*" ".*" ".*"
        {% endif %}
        rabbitmq-plugins enable rabbitmq_management
        service rabbitmq-server restart
#open http://192.168.11.11:15672/
#open http://192.168.11.12:15672/
